package com.buydeem.singleton;

/**
 * IoDH实现的单例
 *
 * @author zengchao
 * @date 2022-04-26 14:27:27
 */
public class IoDHSingleton {

    private IoDHSingleton(){}

    private static class HolderClass{
        private static final IoDHSingleton instance  = new IoDHSingleton();
    }

    public static IoDHSingleton getInstance(){
        return HolderClass.instance;
    }

    public static void main(String[] args) {
        IoDHSingleton instance1 = IoDHSingleton.getInstance();
        IoDHSingleton instance2 = IoDHSingleton.getInstance();
        System.out.println(instance1 == instance2);
    }
}
